package com.example.b_308.software;

import com.example.b_308.software.OfficeContent;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * Created by B-308 on 2017/11/27.
 */
public class OfficeResult {
    /*
    状态码
     */
    public int code;
    /*
    后台回调描述内容
     */
    public String message;
    /*
    后台回调对象
     */
    public String data;

    public OfficeResult(String json) {
        if (null!=json)
            try{
                JSONObject jsonObject=new JSONObject(json);
                this.code=jsonObject.getInt("code");
                this.message=jsonObject.getString("message");
                this.data=jsonObject.getString("data");
            } catch (JSONException e) {
                this.code= OfficeContent.FAIL_BACK;
                this.message=OfficeContent.FAIL_BACK_MESSAGE;
            }
    }

    public OfficeResult(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getData() {
        return data;
    }

    public void setData(String data) {
        this.data = data;
    }
}
